.class public Ljavax/microedition/lcdui/TextField;
.super Ljavax/microedition/lcdui/Item;
.source "TextField.java"


# static fields
.field public static final ANY:I = 0x0

.field public static final CONSTRAINT_MASK:I = 0xffff

.field public static final DECIMAL:I = 0x5

.field public static final EMAILADDR:I = 0x1

.field public static final INITIAL_CAPS_SENTENCE:I = 0x200000

.field public static final INITIAL_CAPS_WORD:I = 0x100000

.field public static final NON_PREDICTIVE:I = 0x80000

.field public static final NUMERIC:I = 0x2

.field public static final PASSWORD:I = 0x10000

.field public static final PHONENUMBER:I = 0x3

.field public static final SENSITIVE:I = 0x40000

.field public static final UNEDITABLE:I = 0x20000

.field public static final URL:I = 0x4


# instance fields
.field private caret:I

.field private caretVisible:Z

.field private constraints:I

.field private field:Ljava/lang/String;

.field private inputMethodListener:Lorg/microemu/device/InputMethodListener;

.field private maxSize:I

.field stringComponent:Ljavax/microedition/lcdui/StringComponent;


# direct methods
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;II)V
    .locals 2
    .parameter "label"
    .parameter "text"
    .parameter "maxSize"
    .parameter "constraints"

    .prologue
    .line 101
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Item;-><init>(Ljava/lang/String;)V

    .line 62
    new-instance v0, Ljavax/microedition/lcdui/TextField$1;

    invoke-direct {v0, p0}, Ljavax/microedition/lcdui/TextField$1;-><init>(Ljavax/microedition/lcdui/TextField;)V

    iput-object v0, p0, Ljavax/microedition/lcdui/TextField;->inputMethodListener:Lorg/microemu/device/InputMethodListener;

    .line 102
    if-gtz p3, :cond_0

    .line 103
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 105
    :cond_0
    invoke-virtual {p0, p4}, Ljavax/microedition/lcdui/TextField;->setConstraints(I)V

    .line 106
    invoke-static {p2, p4}, Lorg/microemu/device/InputMethod;->validate(Ljava/lang/String;I)Z

    move-result v0

    if-nez v0, :cond_1

    .line 107
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 109
    :cond_1
    iput p3, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    .line 110
    new-instance v0, Ljavax/microedition/lcdui/StringComponent;

    invoke-direct {v0}, Ljavax/microedition/lcdui/StringComponent;-><init>()V

    iput-object v0, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    .line 111
    if-eqz p2, :cond_2

    .line 112
    invoke-virtual {p0, p2}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 116
    :goto_0
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    const/16 v1, 0x8

    invoke-virtual {v0, v1}, Ljavax/microedition/lcdui/StringComponent;->setWidthDecreaser(I)V

    .line 117
    return-void

    .line 114
    :cond_2
    const-string v0, ""

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    goto :goto_0
.end method


# virtual methods
.method public delete(II)V
    .locals 4
    .parameter "offset"
    .parameter "length"

    .prologue
    .line 222
    add-int v1, p1, p2

    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v2}, Ljava/lang/String;->length()I

    move-result v2

    if-le v1, v2, :cond_0

    .line 223
    new-instance v1, Ljava/lang/StringIndexOutOfBoundsException;

    invoke-direct {v1}, Ljava/lang/StringIndexOutOfBoundsException;-><init>()V

    throw v1

    .line 225
    :cond_0
    const-string v0, ""

    .line 226
    .local v0, newtext:Ljava/lang/String;
    if-lez p1, :cond_1

    .line 227
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v2, p1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v0

    .line 229
    :cond_1
    add-int v1, p1, p2

    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v2}, Ljava/lang/String;->length()I

    move-result v2

    if-ge v1, v2, :cond_2

    .line 230
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    invoke-virtual {v1, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v2

    add-int v3, p1, p2

    invoke-virtual {v2, v3}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    .line 232
    .restart local v0       #newtext:Ljava/lang/String;
    :cond_2
    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 233
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->repaint()V

    .line 234
    return-void
.end method

.method public getCaretPosition()I
    .locals 1

    .prologue
    .line 264
    iget v0, p0, Ljavax/microedition/lcdui/TextField;->caret:I

    return v0
.end method

.method public getChars([C)I
    .locals 3
    .parameter "data"

    .prologue
    const/4 v2, 0x0

    .line 163
    array-length v0, p1

    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    if-ge v0, v1, :cond_0

    .line 164
    new-instance v0, Ljava/lang/ArrayIndexOutOfBoundsException;

    invoke-direct {v0}, Ljava/lang/ArrayIndexOutOfBoundsException;-><init>()V

    throw v0

    .line 166
    :cond_0
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    invoke-virtual {v0, v2, v1, p1, v2}, Ljava/lang/String;->getChars(II[CI)V

    .line 168
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    return v0
.end method

.method public getConstraints()I
    .locals 1

    .prologue
    .line 283
    iget v0, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    return v0
.end method

.method getHeight()I
    .locals 2

    .prologue
    .line 301
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v0

    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    invoke-virtual {v1}, Ljavax/microedition/lcdui/StringComponent;->getHeight()I

    move-result v1

    add-int/2addr v0, v1

    add-int/lit8 v0, v0, 0x8

    return v0
.end method

.method public getMaxSize()I
    .locals 1

    .prologue
    .line 239
    iget v0, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    return v0
.end method

.method public getString()Ljava/lang/String;
    .locals 1

    .prologue
    .line 122
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    return-object v0
.end method

.method public insert(Ljava/lang/String;I)V
    .locals 4
    .parameter "src"
    .parameter "position"

    .prologue
    .line 192
    iget v1, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    invoke-static {p1, v1}, Lorg/microemu/device/InputMethod;->validate(Ljava/lang/String;I)Z

    move-result v1

    if-nez v1, :cond_0

    .line 193
    new-instance v1, Ljava/lang/IllegalArgumentException;

    invoke-direct {v1}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v1

    .line 195
    :cond_0
    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v2

    add-int/2addr v1, v2

    iget v2, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    if-le v1, v2, :cond_1

    .line 196
    new-instance v1, Ljava/lang/IllegalArgumentException;

    invoke-direct {v1}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v1

    .line 198
    :cond_1
    const-string v0, ""

    .line 199
    .local v0, newtext:Ljava/lang/String;
    if-lez p2, :cond_2

    .line 200
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v2, p2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v0

    .line 202
    :cond_2
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    invoke-virtual {v1, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    .line 203
    .restart local v0       #newtext:Ljava/lang/String;
    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    if-ge p2, v1, :cond_3

    .line 204
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    invoke-virtual {v1, v0}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v2

    add-int/lit8 v3, p2, 0x1

    invoke-virtual {v2, v3}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    .line 206
    .restart local v0       #newtext:Ljava/lang/String;
    :cond_3
    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 207
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->repaint()V

    .line 208
    return-void
.end method

.method public insert([CIII)V
    .locals 2
    .parameter "data"
    .parameter "offset"
    .parameter "length"
    .parameter "position"

    .prologue
    .line 213
    add-int v0, p2, p3

    array-length v1, p1

    if-le v0, v1, :cond_0

    .line 214
    new-instance v0, Ljava/lang/ArrayIndexOutOfBoundsException;

    invoke-direct {v0}, Ljava/lang/ArrayIndexOutOfBoundsException;-><init>()V

    throw v0

    .line 216
    :cond_0
    new-instance v0, Ljava/lang/String;

    invoke-direct {v0, p1, p2, p3}, Ljava/lang/String;-><init>([CII)V

    invoke-virtual {p0, v0, p4}, Ljavax/microedition/lcdui/TextField;->insert(Ljava/lang/String;I)V

    .line 217
    return-void
.end method

.method isFocusable()Z
    .locals 1

    .prologue
    .line 295
    const/4 v0, 0x1

    return v0
.end method

.method paint(Ljavax/microedition/lcdui/Graphics;)I
    .locals 7
    .parameter "g"

    .prologue
    const/4 v6, 0x1

    const/4 v5, 0x0

    const/4 v4, -0x3

    const/4 v3, 0x3

    .line 307
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->paintContent(Ljavax/microedition/lcdui/Graphics;)V

    .line 309
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v1

    invoke-virtual {p1, v5, v1}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 310
    invoke-virtual {p1}, Ljavax/microedition/lcdui/Graphics;->getColor()I

    move-result v0

    .line 311
    .local v0, savedColor:I
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->hasFocus()Z

    move-result v1

    if-nez v1, :cond_0

    .line 312
    const/16 v1, 0x7f

    invoke-virtual {p1, v1}, Ljavax/microedition/lcdui/Graphics;->setGrayScale(I)V

    .line 314
    :cond_0
    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v1}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v1

    sub-int/2addr v1, v3

    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    invoke-virtual {v2}, Ljavax/microedition/lcdui/StringComponent;->getHeight()I

    move-result v2

    add-int/lit8 v2, v2, 0x4

    invoke-virtual {p1, v6, v6, v1, v2}, Ljavax/microedition/lcdui/Graphics;->drawRect(IIII)V

    .line 317
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->hasFocus()Z

    move-result v1

    if-nez v1, :cond_1

    .line 318
    invoke-virtual {p1, v0}, Ljavax/microedition/lcdui/Graphics;->setColor(I)V

    .line 320
    :cond_1
    invoke-virtual {p1, v3, v3}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 321
    invoke-virtual {p0, p1}, Ljavax/microedition/lcdui/TextField;->paintContent(Ljavax/microedition/lcdui/Graphics;)V

    .line 322
    invoke-virtual {p1, v4, v4}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 323
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v1

    neg-int v1, v1

    invoke-virtual {p1, v5, v1}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 325
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getHeight()I

    move-result v1

    return v1
.end method

.method paintContent(Ljavax/microedition/lcdui/Graphics;)V
    .locals 4
    .parameter "g"

    .prologue
    .line 331
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    invoke-virtual {v2, p1}, Ljavax/microedition/lcdui/StringComponent;->paint(Ljavax/microedition/lcdui/Graphics;)I

    .line 332
    iget-boolean v2, p0, Ljavax/microedition/lcdui/TextField;->caretVisible:Z

    if-eqz v2, :cond_0

    .line 333
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    iget v3, p0, Ljavax/microedition/lcdui/TextField;->caret:I

    invoke-virtual {v2, v3}, Ljavax/microedition/lcdui/StringComponent;->getCharPositionX(I)I

    move-result v0

    .line 334
    .local v0, x_pos:I
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    iget v3, p0, Ljavax/microedition/lcdui/TextField;->caret:I

    invoke-virtual {v2, v3}, Ljavax/microedition/lcdui/StringComponent;->getCharPositionY(I)I

    move-result v1

    .line 335
    .local v1, y_pos:I
    invoke-static {}, Ljavax/microedition/lcdui/Font;->getDefaultFont()Ljavax/microedition/lcdui/Font;

    move-result-object v2

    invoke-virtual {v2}, Ljavax/microedition/lcdui/Font;->getHeight()I

    move-result v2

    add-int/2addr v2, v1

    invoke-virtual {p1, v0, v1, v0, v2}, Ljavax/microedition/lcdui/Graphics;->drawLine(IIII)V

    .line 337
    .end local v0           #x_pos:I
    .end local v1           #y_pos:I
    :cond_0
    return-void
.end method

.method setCaretPosition(I)V
    .locals 0
    .parameter "position"

    .prologue
    .line 342
    iput p1, p0, Ljavax/microedition/lcdui/TextField;->caret:I

    .line 343
    return-void
.end method

.method setCaretVisible(Z)V
    .locals 0
    .parameter "state"

    .prologue
    .line 348
    iput-boolean p1, p0, Ljavax/microedition/lcdui/TextField;->caretVisible:Z

    .line 349
    return-void
.end method

.method public setChars([CII)V
    .locals 2
    .parameter "data"
    .parameter "offset"
    .parameter "length"

    .prologue
    .line 174
    if-nez p1, :cond_0

    .line 175
    const-string v1, ""

    invoke-virtual {p0, v1}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 186
    :goto_0
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->repaint()V

    .line 187
    return-void

    .line 177
    :cond_0
    iget v1, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    if-le p3, v1, :cond_1

    .line 178
    new-instance v1, Ljava/lang/IllegalArgumentException;

    invoke-direct {v1}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v1

    .line 180
    :cond_1
    new-instance v0, Ljava/lang/String;

    invoke-direct {v0, p1, p2, p3}, Ljava/lang/String;-><init>([CII)V

    .line 181
    .local v0, newtext:Ljava/lang/String;
    iget v1, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    invoke-static {v0, v1}, Lorg/microemu/device/InputMethod;->validate(Ljava/lang/String;I)Z

    move-result v1

    if-nez v1, :cond_2

    .line 182
    new-instance v1, Ljava/lang/IllegalArgumentException;

    invoke-direct {v1}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v1

    .line 184
    :cond_2
    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public setConstraints(I)V
    .locals 3
    .parameter "constraints"

    .prologue
    const v1, 0xffff

    .line 270
    and-int v0, p1, v1

    if-ltz v0, :cond_0

    and-int v0, p1, v1

    const/4 v1, 0x5

    if-le v0, v1, :cond_1

    .line 272
    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    const-string v2, "constraints "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(I)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, " is an illegal value"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 274
    :cond_1
    iput p1, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    .line 275
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-static {v0, p1}, Lorg/microemu/device/InputMethod;->validate(Ljava/lang/String;I)Z

    move-result v0

    if-nez v0, :cond_2

    .line 276
    const-string v0, ""

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 278
    :cond_2
    return-void
.end method

.method setFocus(Z)V
    .locals 3
    .parameter "hasFocus"

    .prologue
    .line 375
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->setFocus(Z)V

    .line 376
    if-eqz p1, :cond_0

    .line 378
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v1

    invoke-interface {v1}, Lorg/microemu/device/Device;->getInputMethod()Lorg/microemu/device/InputMethod;

    move-result-object v0

    .line 379
    .local v0, inputMethod:Lorg/microemu/device/InputMethod;
    iget-object v1, p0, Ljavax/microedition/lcdui/TextField;->inputMethodListener:Lorg/microemu/device/InputMethodListener;

    invoke-virtual {v0, v1}, Lorg/microemu/device/InputMethod;->setInputMethodListener(Lorg/microemu/device/InputMethodListener;)V

    .line 380
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getMaxSize()I

    move-result v1

    invoke-virtual {v0, v1}, Lorg/microemu/device/InputMethod;->setMaxSize(I)V

    .line 381
    const/4 v1, 0x1

    invoke-virtual {p0, v1}, Ljavax/microedition/lcdui/TextField;->setCaretVisible(Z)V

    .line 387
    .end local v0           #inputMethod:Lorg/microemu/device/InputMethod;
    :goto_0
    return-void

    .line 384
    :cond_0
    invoke-static {}, Lorg/microemu/device/DeviceFactory;->getDevice()Lorg/microemu/device/Device;

    move-result-object v1

    invoke-interface {v1}, Lorg/microemu/device/Device;->getInputMethod()Lorg/microemu/device/InputMethod;

    move-result-object v1

    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->inputMethodListener:Lorg/microemu/device/InputMethodListener;

    invoke-virtual {v1, v2}, Lorg/microemu/device/InputMethod;->removeInputMethodListener(Lorg/microemu/device/InputMethodListener;)V

    .line 385
    const/4 v1, 0x0

    invoke-virtual {p0, v1}, Ljavax/microedition/lcdui/TextField;->setCaretVisible(Z)V

    goto :goto_0
.end method

.method public setInitialInputMode(Ljava/lang/String;)V
    .locals 0
    .parameter "characterSubset"

    .prologue
    .line 290
    return-void
.end method

.method public setMaxSize(I)I
    .locals 2
    .parameter "maxSize"

    .prologue
    .line 245
    if-gtz p1, :cond_0

    .line 246
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 248
    :cond_0
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    if-le v0, p1, :cond_1

    .line 249
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1, p1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;)V

    .line 251
    :cond_1
    iput p1, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    .line 252
    return p1
.end method

.method public setString(Ljava/lang/String;)V
    .locals 1
    .parameter "text"

    .prologue
    .line 128
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v0

    invoke-virtual {p0, p1, v0}, Ljavax/microedition/lcdui/TextField;->setString(Ljava/lang/String;I)V

    .line 129
    return-void
.end method

.method setString(Ljava/lang/String;I)V
    .locals 5
    .parameter "text"
    .parameter "caret"

    .prologue
    const-string v4, ""

    .line 134
    iget v2, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    invoke-static {p1, v2}, Lorg/microemu/device/InputMethod;->validate(Ljava/lang/String;I)Z

    move-result v2

    if-nez v2, :cond_0

    .line 135
    new-instance v2, Ljava/lang/IllegalArgumentException;

    invoke-direct {v2}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v2

    .line 137
    :cond_0
    if-nez p1, :cond_1

    .line 138
    const-string v2, ""

    iput-object v4, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    .line 139
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    const-string v3, ""

    invoke-virtual {v2, v4}, Ljavax/microedition/lcdui/StringComponent;->setText(Ljava/lang/String;)V

    .line 155
    :goto_0
    invoke-virtual {p0, p2}, Ljavax/microedition/lcdui/TextField;->setCaretPosition(I)V

    .line 156
    const/4 v2, 0x0

    invoke-virtual {p0, v2}, Ljavax/microedition/lcdui/TextField;->setCaretVisible(Z)V

    .line 157
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->repaint()V

    .line 158
    return-void

    .line 141
    :cond_1
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v2

    iget v3, p0, Ljavax/microedition/lcdui/TextField;->maxSize:I

    if-le v2, v3, :cond_2

    .line 142
    new-instance v2, Ljava/lang/IllegalArgumentException;

    invoke-direct {v2}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v2

    .line 144
    :cond_2
    iput-object p1, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    .line 145
    iget v2, p0, Ljavax/microedition/lcdui/TextField;->constraints:I

    const/high16 v3, 0x1

    and-int/2addr v2, v3

    if-nez v2, :cond_3

    .line 146
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    invoke-virtual {v2, p1}, Ljavax/microedition/lcdui/StringComponent;->setText(Ljava/lang/String;)V

    goto :goto_0

    .line 148
    :cond_3
    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    .line 149
    .local v1, sb:Ljava/lang/StringBuffer;
    const/4 v0, 0x0

    .local v0, i:I
    :goto_1
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v2

    if-ge v0, v2, :cond_4

    .line 150
    const/16 v2, 0x2a

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;

    .line 149
    add-int/lit8 v0, v0, 0x1

    goto :goto_1

    .line 152
    :cond_4
    iget-object v2, p0, Ljavax/microedition/lcdui/TextField;->stringComponent:Ljavax/microedition/lcdui/StringComponent;

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljavax/microedition/lcdui/StringComponent;->setText(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public size()I
    .locals 1

    .prologue
    .line 258
    iget-object v0, p0, Ljavax/microedition/lcdui/TextField;->field:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    return v0
.end method

.method traverse(IIIZ)I
    .locals 2
    .parameter "gameKeyCode"
    .parameter "top"
    .parameter "bottom"
    .parameter "action"

    .prologue
    const v1, 0x7fffffff

    .line 354
    const/4 v0, 0x1

    if-ne p1, v0, :cond_1

    .line 355
    if-lez p2, :cond_0

    .line 356
    neg-int v0, p2

    .line 369
    :goto_0
    return v0

    :cond_0
    move v0, v1

    .line 358
    goto :goto_0

    .line 361
    :cond_1
    const/4 v0, 0x6

    if-ne p1, v0, :cond_3

    .line 362
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getHeight()I

    move-result v0

    if-le v0, p3, :cond_2

    .line 363
    invoke-virtual {p0}, Ljavax/microedition/lcdui/TextField;->getHeight()I

    move-result v0

    sub-int/2addr v0, p3

    goto :goto_0

    :cond_2
    move v0, v1

    .line 365
    goto :goto_0

    .line 369
    :cond_3
    const/4 v0, 0x0

    goto :goto_0
.end method
